const express = require("express")
const bodyParser = require("body-parser")
//引入users.js
const users=require("./routers/api/users")
const profile=require("./routers/api/profile")
const passport = require("passport")
const app=express();



//使用bodyParser
app.use(bodyParser.json())
app.use(bodyParser.urlencoded({extended:false}));

//处理token 
//初始化
app.use(passport.initialize());
require("./passport")(passport)
//使用router
app.use("/api/users",users)
app.use("/api/profile",profile)



const port = process.env.port || 3000;

app.listen(port,()=>{
  console.log(`Server running on port ${port}`);
  
})